<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Checks if this node is ASP</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="tidynode.hassiblings.html">tidyNode::hasSiblings</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="tidynode.iscomment.html">tidyNode::isComment</a></div>
 <div class="up"><a href="class.tidynode.html">tidyNode</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="tidynode.isasp" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">tidyNode::isAsp</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.0.1)</p><p class="refpurpose"><span class="refname">tidyNode::isAsp</span> &mdash; <span class="dc-title">Checks if this node is ASP</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-tidynode.isasp-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">bool</span> <span class="methodname"><strong>tidyNode::isAsp</strong></span>
    ( <span class="methodparam">void</span>
   )</div>

  <p class="para rdfs-comment">
   Tells whether the current node is ASP.
  </p>
 </div>

 
 <div class="refsect1 returnvalues" id="refsect1-tidynode.isasp-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   Returns <strong><code>TRUE</code></strong> if the node is ASP, <strong><code>FALSE</code></strong> otherwise.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-tidynode.isasp-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-3968">
    <p><strong>Example #1 Extract ASP code from a mixed HTML document</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /><br />$html&nbsp;</span><span style="color: #007700">=&nbsp;&lt;&lt;&lt;&nbsp;HTML<br /></span><span style="color: #DD0000">&lt;html&gt;&lt;head&gt;<br />&lt;?php&nbsp;echo&nbsp;'&lt;title&gt;title&lt;/title&gt;';&nbsp;?&gt;<br />&lt;#&nbsp;<br />&nbsp;&nbsp;/*&nbsp;JSTE&nbsp;code&nbsp;*/<br />&nbsp;&nbsp;alert('Hello&nbsp;World');&nbsp;<br />#&gt;<br />&lt;/head&gt;<br />&lt;body&gt;<br /><br />&lt;?php<br />&nbsp;&nbsp;//&nbsp;PHP&nbsp;code<br />&nbsp;&nbsp;echo&nbsp;'hello&nbsp;world!';<br />?&gt;<br /><br />&lt;%<br />&nbsp;&nbsp;/*&nbsp;ASP&nbsp;code&nbsp;*/<br />&nbsp;&nbsp;response.write("Hello&nbsp;World!")<br />%&gt;<br /><br />&lt;!--&nbsp;Comments&nbsp;--&gt;<br />Hello&nbsp;World<br />&lt;/body&gt;&lt;/html&gt;<br />Outside&nbsp;HTML<br /></span><span style="color: #007700">HTML;<br /><br /><br /></span><span style="color: #0000BB">$tidy&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">tidy_parse_string</span><span style="color: #007700">(</span><span style="color: #0000BB">$html</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$num&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">get_nodes</span><span style="color: #007700">(</span><span style="color: #0000BB">$tidy</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">html</span><span style="color: #007700">());<br /><br />function&nbsp;</span><span style="color: #0000BB">get_nodes</span><span style="color: #007700">(</span><span style="color: #0000BB">$node</span><span style="color: #007700">)&nbsp;{<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">//&nbsp;check&nbsp;if&nbsp;the&nbsp;current&nbsp;node&nbsp;is&nbsp;of&nbsp;requested&nbsp;type<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">if(</span><span style="color: #0000BB">$node</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">isAsp</span><span style="color: #007700">())&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">"\n\n#&nbsp;asp&nbsp;node&nbsp;#"&nbsp;</span><span style="color: #007700">.&nbsp;++</span><span style="color: #0000BB">$GLOBALS</span><span style="color: #007700">[</span><span style="color: #DD0000">'num'</span><span style="color: #007700">]&nbsp;.&nbsp;</span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #0000BB">$node</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">value</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">//&nbsp;check&nbsp;if&nbsp;the&nbsp;current&nbsp;node&nbsp;has&nbsp;childrens<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">if(</span><span style="color: #0000BB">$node</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">hasChildren</span><span style="color: #007700">())&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;foreach(</span><span style="color: #0000BB">$node</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">child&nbsp;</span><span style="color: #007700">as&nbsp;</span><span style="color: #0000BB">$child</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">get_nodes</span><span style="color: #007700">(</span><span style="color: #0000BB">$child</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />}<br /><br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

    <div class="example-contents"><p>以上例程会输出：</p></div>
    <div class="example-contents screen">
<div class="cdata"><pre>
# asp node #1
&lt;%
  /* ASP code */
  response.write(&quot;Hello World!&quot;)
%&gt;
</pre></div>
    </div>
   </div>
  </p>
 </div>


 <div class="refsect1 notes" id="refsect1-tidynode.isasp-notes">
  <h3 class="title">注释</h3>  
  <blockquote class="note"><p><strong class="note">Note</strong>: 
   <p class="para">
    This function was named <span class="function"><strong>tidy_node::is_asp()</strong></span> in
    PHP 4/Tidy 1.
   </p>
  </p></blockquote>
 </div>

</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="tidynode.hassiblings.html">tidyNode::hasSiblings</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="tidynode.iscomment.html">tidyNode::isComment</a></div>
 <div class="up"><a href="class.tidynode.html">tidyNode</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
